JBoss Community Archive (Read Only)

Teiid 8.1

BNF for SQL Grammar

Reserved Keywords

Keyword

Usage

ALL

standard aggregate function, function, query expression body, query term
select clause, quantified comparison predicate

ALTER

alter

AND

between predicate, boolean term

ANY

standard aggregate function, quantified comparison predicate

ARRAY_AGG

ordered aggreate function

AS

alter, array table, create procedure, option namespace
create table, create trigger, derived column, dynamic data statement
function, loop statement, xml namespace element, select derived column
table subquery, text table, table name, with list element
xml serialize, xml table

ASC

sort specification

ATOMIC

compound statement, for each row trigger action

BEGIN

compound statement, for each row trigger action

BETWEEN

between predicate

BIGDECIMAL

data type

BIGINT

data type

BIGINTEGER

data type

BLOB

data type

BOOLEAN

data type

BOTH

function

BREAK

branching statement

BY

group by clause, order by clause, window specification

BYTE

data type

CALL

callable statement, call statement

CASE

case expression, searched case expression

CAST

function

CHAR

function, data type

CLOB

data type, xml serialize

CONSTRAINT

create table

CONTINUE

branching statement

CONVERT

function

CREATE

create procedure, create table, create temporary table, create trigger
procedure body definition

CROSS

cross join

DATE

data type

DAY

function

DECIMAL

data type

DECLARE

declare statement

DEFAULT

table element, xml namespace element, procedure parameter, xml table column

DELETE

alter, create trigger, delete statement

DESC

sort specification

DISTINCT

standard aggregate function, function, query expression body, query term
select clause

DOUBLE

data type

DROP

drop table

EACH

for each row trigger action

ELSE

case expression, if statement, searched case expression

END

case expression, compound statement, for each row trigger action, searched case expression

ERROR

raise error statement

ESCAPE

match predicate, text table

EXCEPT

query expression body

EXEC

dynamic data statement, call statement

EXECUTE

dynamic data statement, call statement

EXISTS

exists predicate

FALSE

non numeric literal

FETCH

fetch clause

FILTER

filter clause

FLOAT

data type

FOR

for each row trigger action, function, text aggreate function, xml table column

FOREIGN

create procedure, create table, foreign key

FROM

delete statement, from clause, function

FULL

qualified table

FUNCTION

create procedure

GROUP

group by clause

HAVING

having clause

HOUR

function

IF

if statement

IMMEDIATE

dynamic data statement

IN

procedure parameter, in predicate

INNER

qualified table

INOUT

procedure parameter

INSERT

alter, create trigger, function, insert statement

INTEGER

data type

INTERSECT

query term

INTO

dynamic data statement, insert statement, into clause

IS

is null predicate

JOIN

cross join, qualified table

LATERAL

table subquery

LEADING

function

LEAVE

branching statement

LEFT

function, qualified table

LIKE

match predicate

LIKE_REGEX

like regex predicate

LIMIT

limit clause

LOCAL

create temporary table

LONG

data type

LOOP

loop statement

MAKEDEP

option clause, table primary

MAKENOTDEP

option clause, table primary

MINUTE

function

MONTH

function

NO

xml namespace element, text table column, text table

NOCACHE

option clause

NOT

between predicate, compound statement, table element, is null predicate
match predicate, boolean factor, procedure parameter, procedure result column
like regex predicate, in predicate, temporary table element

NULL

table element, is null predicate, non numeric literal, procedure parameter
procedure result column, temporary table element, xml query

OBJECT

data type

OF

alter, create trigger

OFFSET

limit clause

ON

alter, create trigger, loop statement, qualified table
xml query

ONLY

fetch clause

OPTION

option clause

OPTIONS

options clause

OR

boolean value expression

ORDER

order by clause

OUT

procedure parameter

OUTER

qualified table

OVER

window specification

PARTITION

window specification

PRIMARY

table element, create temporary table, primary key

PROCEDURE

alter, create procedure, procedure body definition

REAL

data type

REFERENCES

foreign key

RETURNS

create procedure

RIGHT

function, qualified table

ROW

fetch clause, for each row trigger action, limit clause, text table

ROWS

fetch clause, limit clause

SECOND

function

SELECT

select clause

SET

option namespace, update statement

SHORT

data type

SIMILAR

match predicate

SMALLINT

data type

SOME

standard aggregate function, quantified comparison predicate

STRING

dynamic data statement, data type, xml serialize

TABLE

create procedure, create table, create temporary table, drop table
query primary, table subquery

TEMPORARY

create temporary table

THEN

case expression, searched case expression

TIME

data type

TIMESTAMP

data type

TINYINT

data type

TO

match predicate

TRAILING

function

TRANSLATE

function

TRIGGER

alter, create trigger

TRUE

non numeric literal

UNION

cross join, query expression body

UNIQUE

other constraints, table element

UNKNOWN

non numeric literal

UPDATE

alter, create trigger, dynamic data statement, update statement

USER

function

USING

dynamic data statement

VALUES

insert statement

VARBINARY

data type

VARCHAR

data type, xml serialize

VIRTUAL

create procedure, create table, procedure body definition

WHEN

case expression, searched case expression

WHERE

filter clause, where clause

WHILE

while statement

WITH

query expression

XML

data type

XMLAGG

ordered aggreate function

XMLATTRIBUTES

xml attributes

XMLCOMMENT

function

XMLCONCAT

function

XMLELEMENT

xml element

XMLFOREST

xml forest

XMLNAMESPACES

xml namespaces

XMLPARSE

xml parse

XMLPI

function

XMLQUERY

xml query

XMLSERIALIZE

xml serialize

XMLTABLE

xml table

YEAR

function

Reserved Keywords

Keyword

Usage

ACCESSPATTERN

other constraints, non-reserved identifier

ARRAYTABLE

array table, non-reserved identifier

AUTO_INCREMENT

table element, non-reserved identifier

AVG

standard aggregate function, non-reserved identifier

COLUMNS

array table, non-reserved identifier, text table, xml table

CONTENT

non-reserved identifier, xml parse, xml serialize

COUNT

standard aggregate function, non-reserved identifier

DELIMITER

non-reserved identifier, text aggreate function, text table

DENSE_RANK

analytic aggregate function, non-reserved identifier

DISABLED

alter, non-reserved identifier

DOCUMENT

non-reserved identifier, xml parse, xml serialize

EMPTY

non-reserved identifier, xml query

ENABLED

alter, non-reserved identifier

ENCODING

non-reserved identifier, text aggreate function

EVERY

standard aggregate function, non-reserved identifier

EXTRACT

function, non-reserved identifier

FIRST

fetch clause, non-reserved identifier, sort specification

HEADER

non-reserved identifier, text aggreate function, text table

INDEX

other constraints, table element, non-reserved identifier

INSTEAD

alter, create trigger, non-reserved identifier

KEY

table element, create temporary table, foreign key, non-reserved identifier
primary key

LAST

non-reserved identifier, sort specification

MAX

standard aggregate function, non-reserved identifier

MIN

standard aggregate function, non-reserved identifier

NAME

function, non-reserved identifier, xml element

NAMESPACE

option namespace, non-reserved identifier

NEXT

fetch clause, non-reserved identifier

NULLS

non-reserved identifier, sort specification

ORDINALITY

non-reserved identifier, xml table column

PASSING

non-reserved identifier, xml query, xml table

PATH

non-reserved identifier, xml table column

QUERYSTRING

non-reserved identifier, querystring function

QUOTE

non-reserved identifier, text aggreate function, text table

RANK

analytic aggregate function, non-reserved identifier

RESULT

non-reserved identifier, procedure parameter

ROW_NUMBER

analytic aggregate function, non-reserved identifier

SELECTOR

non-reserved identifier, text table column, text table

SERIAL

non-reserved identifier, temporary table element

SKIP

non-reserved identifier, text table

SQL_TSI_DAY

time interval, non-reserved identifier

SQL_TSI_FRAC_SECOND

time interval, non-reserved identifier

SQL_TSI_HOUR

time interval, non-reserved identifier

SQL_TSI_MINUTE

time interval, non-reserved identifier

SQL_TSI_MONTH

time interval, non-reserved identifier

SQL_TSI_QUARTER

time interval, non-reserved identifier

SQL_TSI_SECOND

time interval, non-reserved identifier

SQL_TSI_WEEK

time interval, non-reserved identifier

SQL_TSI_YEAR

time interval, non-reserved identifier

STDDEV_POP

standard aggregate function, non-reserved identifier

STDDEV_SAMP

standard aggregate function, non-reserved identifier

SUBSTRING

function, non-reserved identifier

SUM

standard aggregate function, non-reserved identifier

TEXTAGG

non-reserved identifier, text aggreate function

TEXTTABLE

non-reserved identifier, text table

TIMESTAMPADD

function, non-reserved identifier

TIMESTAMPDIFF

function, non-reserved identifier

TO_BYTES

function, non-reserved identifier

TO_CHARS

function, non-reserved identifier

TRIM

function, non-reserved identifier, text table column

VAR_POP

standard aggregate function, non-reserved identifier

VAR_SAMP

standard aggregate function, non-reserved identifier

VIEW

alter, create table, non-reserved identifier

WELLFORMED

non-reserved identifier, xml parse

WIDTH

non-reserved identifier, text table column

Reserved Keywords For Future Use

ADD

ALLOCATE

ARE

ARRAY

ASENSITIVE

ASYMETRIC

AUTHORIZATION

BINARY

CALLED

CASCADED

CHARACTER

CHECK

CLOSE

COLLATE

COLUMN

COMMIT

CONNECT

CORRESPONDING

CRITERIA

CURRENT_DATE

CURRENT_TIME

CURRENT_TIMESTAMP

CURRENT_USER

CURSOR

CYCLE

DATALINK

DEALLOCATE

DEC

DEREF

DESCRIBE

DETERMINISTIC

DISCONNECT

DLNEWCOPY

DLPREVIOUSCOPY

DLURLCOMPLETE

DLURLCOMPLETEONLY

DLURLCOMPLETEWRITE

DLURLPATH

DLURLPATHONLY

DLURLPATHWRITE

DLURLSCHEME

DLURLSERVER

DLVALUE

DYNAMIC

ELEMENT

EXTERNAL

FREE

GET

GLOBAL

GRANT

HAS

HOLD

IDENTITY

IMPORT

INDICATOR

INPUT

INSENSITIVE

INT

INTERVAL

ISOLATION

LANGUAGE

LARGE

LOCALTIME

LOCALTIMESTAMP

MATCH

MEMBER

MERGE

METHOD

MODIFIES

MODULE

MULTISET

NATIONAL

NATURAL

NCHAR

NCLOB

NEW

NONE

NUMERIC

OLD

OPEN

OUTPUT

OVERLAPS

PARAMETER

PRECISION

PREPARE

RANGE

READS

RECURSIVE

REFERENCING

RELEASE

RETURN

REVOKE

ROLLBACK

ROLLUP

SAVEPOINT

SCROLL

SEARCH

SENSITIVE

SESSION_USER

SPECIFIC

SPECIFICTYPE

SQL

SQLEXCEPTION

SQLSTATE

SQLWARNING

START

STATIC

SUBMULTILIST

SYMETRIC

SYSTEM

SYSTEM_USER

TIMEZONE_HOUR

TIMEZONE_MINUTE

TRANSLATION

TREAT

VALUE

VARYING

WHENEVER

WINDOW

WITHIN

WITHOUT

XMLBINARY

XMLCAST

XMLDOCUMENT

XMLEXISTS

XMLITERATE

XMLTEXT

XMLVALIDATE

Tokens

Name

Definition

Usage

all in group identifier

<identifier> <period> <star>

all in group

binary string literal

"X" | "x" "\'" (<hexit> <hexit>)+ "\'"

non numeric literal

colon

":"

assignment statement, declare statement, data statement, statement

comma

","

column list, create procedure, typed element list, create table
create temporary table, named parameter list, expression list, from clause
function, column name list, limit clause, option clause
options clause, order by clause, data type, query expression
querystring function, select clause, set clause list, in predicate
text aggreate function, text table, xml attributes, xml element
xml forest, xml namespaces, xml query, xml table

concat_op

"||"

common value expression

decimal numeric literal

(<digit>)* <period> <unsigned integer literal>

unsigned numeric literal

digit

["0"-"9"]

dollar

"$"

unsigned value expression primary

eq

"="

assignment statement, callable statement, declare statement, named parameter list
comparison operator, set clause list, data statement

escaped function

"{" "fn"

unsigned value expression primary

escaped join

"{" "oj"

table reference

escaped type

"{" ("d" | "t" | "ts" | "b")

non numeric literal

approximate numeric literal

<digit> <period> <unsigned integer literal> ["e","E"] (<plus> | <minus>)? <unsigned integer literal>

unsigned numeric literal

ge

">="

comparison operator

gt

">"

named parameter list, comparison operator

hexit

["a"-"f","A"-"F"] | <digit>

identifier

<quoted_id> (<period> <quoted_id>)*

identifier, unsigned value expression primary

id_part

("@" | "#" | <letter>) (<letter> | "_" | <digit>)*

lbrace

"{"

callable statement, match predicate

le

"<="

comparison operator

letter

["a"-"z","A"-"Z"] | ["\u0153"-"\ufffd"]

lparen

"("

standard aggregate function, analytic aggregate function, array table, callable statement
column list, create procedure, create table, create temporary table
filter clause, function, column name list, if statement
insert statement, loop statement, options clause, ordered aggreate function
data type, query primary, querystring function, in predicate
call statement, subquery, table subquery, table primary
text aggreate function, text table, unsigned value expression primary, while statement
window specification, with list element, xml attributes, xml element
xml forest, xml namespaces, xml parse, xml query
xml serialize, xml table

lsbrace

"["

unsigned value expression primary

lt

"<"

comparison operator

minus

"-"

plus or minus

ne

"<>"

comparison operator

ne2

"!="

comparison operator

period

"."

plus

"+"

plus or minus

qmark

"?"

callable statement, integer parameter, unsigned value expression primary

quoted_id

<id_part> | "\"" ("\"\"" | ~["\""])+ "\""

rbrace

"}"

callable statement, match predicate, non numeric literal, table reference
unsigned value expression primary

rparen

")"

standard aggregate function, analytic aggregate function, array table, callable statement
column list, create procedure, create table, create temporary table
filter clause, function, column name list, if statement
insert statement, loop statement, options clause, ordered aggreate function
data type, query primary, querystring function, in predicate
call statement, subquery, table subquery, table primary
text aggreate function, text table, unsigned value expression primary, while statement
window specification, with list element, xml attributes, xml element
xml forest, xml namespaces, xml parse, xml query
xml serialize, xml table

rsbrace

"]"

unsigned value expression primary

semicolon

";"

ddl statement, delimited statement

slash

"/"

star or slash

star

"*"

standard aggregate function, dynamic data statement, select clause, star or slash

string literal

("N" | "E")? "\'" ("\'\'" | ~["\'"])* "\'"

string

unsigned integer literal

(<digit>)+

unsigned integer, unsigned numeric literal

Production Cross-Reference

Name

Usage

standard aggregate function

unsigned value expression primary

all in group

select sublist

alter

directly executable statement

analytic aggregate function

unsigned value expression primary

array table

table primary

assignment statement

delimited statement

assignment statement operand

assignment statement, declare statement

between predicate

boolean primary

boolean primary

filter clause, boolean factor

branching statement

delimited statement

case expression

unsigned value expression primary

character

match predicate, text aggreate function, text table

column list

insert statement, with list element

common value expression

between predicate, boolean primary, comparison predicate, match predicate
like regex predicate, in predicate, text table

comparison predicate

boolean primary

boolean term

boolean value expression

boolean value expression

condition

compound statement

statement

other constraints

create table

table element

create table

create procedure

ddl statement

typed element list

array table, dynamic data statement

option namespace

ddl statement

create table

ddl statement

create temporary table

directly executable statement

create trigger

ddl statement, directly executable statement

condition

expression, having clause, if statement, qualified table
searched case expression, where clause, while statement

cross join

joined table

declare statement

delimited statement

delete statement

assignment statement operand, directly executable statement

delimited statement

statement

derived column

querystring function, text aggreate function, xml attributes, xml forest
xml query, xml table

drop table

directly executable statement

dynamic data statement

data statement

raise error statement

delimited statement

named parameter list

call statement

exists predicate

boolean primary

expression

standard aggregate function, assignment statement operand, case expression, derived column
dynamic data statement, raise error statement, named parameter list, expression list
function, ordered aggreate function, querystring function, searched case expression
select derived column, set clause list, sort key, unsigned value expression primary
xml table column, xml element, xml parse, xml serialize

expression list

callable statement, function, group by clause, insert statement
call statement, window specification

fetch clause

limit clause

filter clause

function, unsigned value expression primary

for each row trigger action

alter, create trigger

foreign key

create table

from clause

query

function

unsigned value expression primary

column name list

foreign key

group by clause

query

having clause

query

identifier

alter, array table, assignment statement, branching statement
callable statement, column list, table element, create procedure
typed element list, option namespace, create table, create temporary table
create trigger, declare statement, delete statement, derived column
drop table, dynamic data statement, named parameter list, foreign key
function, column name list, insert statement, into clause
loop statement, xml namespace element, option clause, option pair
procedure parameter, procedure result column, query primary, select derived column
set clause list, data statement, statement, call statement
table subquery, temporary table element, text aggreate function, text table column
text table, table name, update statement, with list element
xml table column, xml element, xml table

if statement

statement

insert statement

assignment statement operand, directly executable statement

integer parameter

fetch clause, limit clause

unsigned integer

dynamic data statement, integer parameter, data type, text table column
text table, unsigned value expression primary

time interval

function

into clause

query

is null predicate

boolean primary

joined table

table primary, table reference

limit clause

query expression body

loop statement

statement

match predicate

boolean primary

xml namespace element

xml namespaces

non numeric literal

option pair, value expression primary

non-reserved identifier

identifier, unsigned value expression primary

boolean factor

boolean term

comparison operator

comparison predicate, quantified comparison predicate

option clause

callable statement, delete statement, insert statement, query expression body
call statement, update statement

option pair

options clause

options clause

other constraints, table element, create procedure, create table
foreign key, primary key, procedure parameter, procedure result column

order by clause

function, ordered aggreate function, query expression body, text aggreate function
window specification

ordered aggreate function

unsigned value expression primary

data type

table element, create procedure, typed element list, declare statement
function, procedure parameter, procedure result column, temporary table element
text table column, xml table column

numeric value expression

common value expression

plus or minus

option pair, numeric value expression, value expression primary

primary key

create table

procedure parameter

create procedure

procedure result column

create procedure

qualified table

joined table

query

query primary

query expression

alter, assignment statement operand, create table, insert statement
loop statement, subquery, table subquery, directly executable statement
with list element

query expression body

query expression, query primary

query primary

query term

querystring function

function

query term

query expression body

like regex predicate

boolean primary

searched case expression

unsigned value expression primary

select clause

query

select derived column

select sublist

select sublist

select clause

set clause list

dynamic data statement, update statement

in predicate

boolean primary

sort key

sort specification

sort specification

order by clause

data statement

delimited statement

statement

alter, compound statement, create procedure, for each row trigger action
if statement, loop statement, procedure body definition, while statement

call statement

data statement, subquery, table subquery, directly executable statement

string

character, table element, option namespace, function
xml namespace element, non numeric literal, procedure parameter, text table column
text table, xml table column, xml query, xml table

subquery

exists predicate, in predicate, quantified comparison predicate, unsigned value expression primary

quantified comparison predicate

boolean primary

table subquery

table primary

temporary table element

create temporary table

table primary

cross join, joined table

table reference

from clause, qualified table

text aggreate function

unsigned value expression primary

text table column

text table

text table

table primary

term

numeric value expression

star or slash

term

table name

table primary

unsigned numeric literal

option pair, value expression primary

unsigned value expression primary

value expression primary

update statement

assignment statement operand, directly executable statement

directly executable statement

data statement

value expression primary

array table, term

where clause

delete statement, query, update statement

while statement

statement

window specification

unsigned value expression primary

with list element

query expression

xml attributes

xml element

xml table column

xml table

xml element

function

xml forest

function

xml namespaces

xml element, xml forest, xml query, xml table

xml parse

function

xml query

function

xml serialize

function

xml table

table primary

Productions

string ::=

A string literal value. Use '' to escape ' in the string.

Example:

'a string'
'it''s a string'

identifier ::=

Partial or full name of a single entity.

Example:

tbl.col
"tbl"."col"

create trigger ::=

Creates a trigger action on the given target.

Example:

CREATE TRIGGER ON vw INSTEAD OF INSERT AS FOR EACH ROW BEGIN ATOMIC ... END

alter ::=

Alter the given target.

Example:

ALTER VIEW vw AS SELECT col FROM tbl

for each row trigger action ::=

Defines an action to perform on each row.

Example:

FOR EACH ROW BEGIN ATOMIC ... END

directly executable statement ::=

A statement that can be executed at runtime.

Example:

SELECT * FROM tbl

drop table ::=

Creates a trigger action on the given target.

Example:

CREATE TRIGGER ON vw INSTEAD OF INSERT AS FOR EACH ROW BEGIN ATOMIC ... END

create temporary table ::=

Creates a temporary table.

Example:

CREATE LOCAL TEMPORARY TABLE tmp (col integer)

temporary table element ::=

Defines a temporary table column.

Example:

col string NOT NULL

raise error statement ::=

Raises an error with the given message.

Example:

ERROR 'something went wrong'

statement ::=

A procedure statement.

Example:

IF (x = 5) BEGIN ... END

delimited statement ::=

A procedure statement terminated by ;.

Example:

SELECT * FROM tbl;

compound statement ::=

A procedure statement block contained in BEGIN END.

Example:

BEGIN NOT ATOMIC ... END

branching statement ::=

A procedure branching control statement, which typically specifies a label to return control to.

Example:

BREAK x

while statement ::=

A procedure while statement that executes until its condition is false.

Example:

WHILE (var) BEGIN ... END

loop statement ::=

A procedure loop statement that executes over the given cursor.

Example:

LOOP ON (SELECT * FROM tbl) AS x BEGIN ... END

if statement ::=

A procedure loop statement that executes over the given cursor.

Example:

LOOP ON (SELECT * FROM tbl) AS x BEGIN ... END

declare statement ::=

A procedure declaration statement that creates a variable and optionally assigns a value.

Example:

DECLARE STRING x := 'a'

assignment statement ::=

Assigns a variable a value in a procedure.

Example:

x := 'b'

assignment statement operand ::=

A value or command that can be used in an assignment.

All assigments except for expression are deprecated.

data statement ::=

A procedure statement that executes a SQL statement. An update statement can have its update count accessed via the ROWS_UPDATED variable.

procedure body definition ::=

Defines a procedure body on a Procedure metadata object.

Example:

CREATE VIRTUAL PROCEDURE BEGIN ... END

dynamic data statement ::=

A procedure statement that can execute arbitrary sql.

Example:

EXECUTE IMMEDIATE 'SELECT * FROM tbl' AS x STRING INTO #temp

set clause list ::=

A list of value assignments.

Example:

col1 = 'x', col2 = 'y' ...

typed element list ::=

A list of typed elements.

Example:

col1 string, col2 integer ...

callable statement ::=

A callable statement defined using JDBC escape syntax.

Example:

{? = CALL proc}

call statement ::=

Executes the procedure with the given parameters.

Example:

CALL proc('a', 1)

named parameter list ::=

A list of named parameters.

Example:

param1 => 'x', param2 => 1

insert statement ::=

Inserts values into the given target.

Example:

INSERT INTO tbl (col1, col2) VALUES ('a', 1)

column list ::=

A list of column references.

Example:

(col1, col2, ...)

expression list ::=

A list of expressions.

Example:

col1, 'a', ...

update statement ::=

Update values in the given target.

Example:

UPDATE tbl SET (col1 = 'a') WHERE col2 = 1

delete statement ::=

Delete rows from the given target.

Example:

DELETE FROM tbl WHERE col2 = 1

query expression ::=

A declarative query for data.

Example:

SELECT * FROM tbl WHERE col2 = 1

with list element ::=

A query expression for use in the enclosing query.

Example:

X (Y, Z) AS (SELECT 1, 2)

query expression body ::=

The body of a query expression, which can optionally be ordered and limited.

Example:

SELECT * FROM tbl ORDER BY col1 LIMIT 1

query term ::=

Used to establish INTERSECT precedence.

Example:

SELECT * FROM tbl
SELECT * FROM tbl1 INTERSECT SELECT * FROM tbl2

query primary ::=

A declarative source of rows.

Example:

TABLE tbl
SELECT * FROM tbl1

query ::=

A SELECT query.

Example:

SELECT col1, max(col2) FROM tbl GROUP BY col1

into clause ::=

Used to direct the query into a table.

This is deprecated. Use INSERT INTO with a query expression instead.

Example:

INTO tbl

select clause ::=

The columns returned by a query. Can optionally be distinct.

Example:

SELECT *
SELECT DISTINCT a, b, c

select sublist ::=

An element in the select clause

Example:

tbl.*
tbl.col AS x

select derived column ::=

A select clause item that selects a single column.

This is slightly different than a derived column in that the AS keyword is optional.

Example:

tbl.col AS x

derived column ::=

An optionally named expression.

Example:

tbl.col AS x

all in group ::=

A select sublist that can select all columns from the given group.

Example:

tbl.*

ordered aggreate function ::=

An aggregate function that can optionally be ordered.

Example:

XMLAGG(col1) ORDER BY col2
ARRAY_AGG(col1)

text aggreate function ::=

An aggregate function for creating separated value clobs.

Example:

TEXTAGG (col1 as t1, col2 as t2 DELIMITER ',' HEADER)

standard aggregate function ::=

A standard aggregate function.

Example:

COUNT(*)

analytic aggregate function ::=

An analytic aggregate function.

Example:

ROW_NUMBER()

filter clause ::=

An aggregate filter clause applied prior to accumulating the value.

Example:

FILTER (WHERE col1='a')

from clause ::=

A query from clause containing a list of table references.

Example:

FROM a, b
FROM a right outer join b, c, d join e".</p>

table reference ::=

An optionally escaped joined table.

Example:

a
a inner join b

joined table ::=

A table or join.

Example:

a
a inner join b

cross join ::=

A cross join.

Example:

a CROSS JOIN b

qualified table ::=

An INNER or OUTER join.

Example:

a inner join b

table primary ::=

A single source of rows.

Example:

a

xml serialize ::=

Serializes an XML value.

Example:

XMLSERIALIZE(col1 AS CLOB)

array table ::=

The ARRAYTABLE table function creates tabular results from arrays. It can be used as a nested table reference.

Example:

ARRAYTABLE (col1 COLUMNS x STRING) AS y

text table ::=

The TEXTTABLE table function creates tabular results from text. It can be used as a nested table reference.

Example:

TEXTTABLE (file COLUMNS x STRING) AS y

text table column ::=

A text table column.

Example:

x INTEGER WIDTH 6

xml query ::=

Executes an XQuery to return an XML result.

Example:

XMLQUERY('<a>...</a>' PASSING doc)

xml table ::=

Returns table results by processing an XQuery.

Example:

XMLTABLE('/a/b' PASSING doc COLUMNS col XML PATH '.') AS X

xml table column ::=

XML table column.

Example:

y FOR ORDINALITY

unsigned integer ::=

An unsigned interger value.

Example:

12345

table subquery ::=

A table defined by a subquery.

Example:

(SELECT * FROM tbl) AS x

table name ::=

A table named in the FROM clause.

Example:

tbl AS x

where clause ::=

Specifies a search condition

Example:

WHERE x = 'a'

condition ::=

A boolean expression.

boolean value expression ::=

An optionally ORed boolean expression.

boolean term ::=

An optional ANDed boolean factor.

boolean factor ::=

A boolean factor.

Example:

NOT x = 'a'

boolean primary ::=

A boolean predicate or simple expression.

Example:

col LIKE 'a%'

comparison operator ::=

A comparison operator.

Example:

=

comparison predicate ::=

A value comparison.

Example:

x = 'a'

subquery ::=

A subquery.

Example:

(SELECT * FROM tbl)

quantified comparison predicate ::=

A subquery comparison.

Example:

= ANY (SELECT col FROM tbl)

match predicate ::=

Matches based upon a pattern.

Example:

LIKE 'a_'

like regex predicate ::=

A regular expression match.

Example:

LIKE_REGEX 'a.*b'

character ::=

A single character.

Example:

'a'

between predicate ::=

A comparison between two values.

Example:

BETWEEN 1 AND 5

is null predicate ::=

A null test.

Example:

IS NOT NULL

in predicate ::=

A comparison with multiple values.

Example:

IN (1, 5)

exists predicate ::=

A test if rows exist.

Example:

EXISTS (SELECT col FROM tbl)

group by clause ::=

Defines the grouping columns

Example:

GROUP BY col1, col2

having clause ::=

Search condition applied after grouping.

Example:

HAVING max(col1) = 5

order by clause ::=

Specifices row ordering.

Example:

ORDER BY x, y DESC

sort specification ::=

Defines how to sort on a particular expression

Example:

col1 NULLS FIRST

sort key ::=

A sort expression.

Example:

col1

integer parameter ::=

A literal integer or parameter reference to an integer.

Example:

?

limit clause ::=

Limits and/or offsets the resultant rows.

Example:

LIMIT 2

fetch clause ::=

ANSI limit.

Example:

FETCH FIRST 1 ROWS ONLY

option clause ::=

Specifies query options.

Example:

OPTION MAKEDEP tbl

expression ::=

A value.

Example:

col1

common value expression ::=

Establishes the precedence of concat.

Example:

'a' || 'b'

numeric value expression ::=

Example:

1 + 2

plus or minus ::=

The + or - operator.

Example:

+

term ::=

A numeric term

Example:

1 * 2

star or slash ::=

The * or / operator.

Example:

/

value expression primary ::=

A simple value expression.

Example:

+col1

window specification ::=

The window specification for an analytical or windowed aggregate function.

Example:

OVER (PARTION BY col1)

case expression ::=

If/then/else chain using a common search predicand.

Example:

CASE col1 WHEN 'a' THEN 1 ELSE 2

searched case expression ::=

If/then/else chain using multiple search conditions.

Example:

CASE WHEN x = 'a' THEN 1 WHEN y = 'b' THEN 2

xml parse ::=

Parses the given value as XML.

Example:

XMLPARSE(DOCUMENT doc WELLFORMED)

querystring function ::=

Produces a URL query string from the given arguments.

Example:

QUERYSTRING(col1 AS opt, col2 AS val)

xml element ::=

Creates an XML element.

Example:

XMLELEMENT(NAME "root", child)

xml attributes ::=

Creates attributes for the containing element.

Example:

XMLATTRIBUTES(col1 AS attr1, col2 AS attr2)

xml forest ::=

Produces an element for each derived column.

Example:

XMLFOREST(col1 AS ELEM1, col2 AS ELEM2)

xml namespaces ::=

Defines XML namespace URI/prefix combinations

Example:

XMLNAMESPACES('http://foo' AS foo)

xml namespace element ::=

An xml namespace

Example:

NO DEFAULT

non numeric literal ::=

An escaped or simple non numeric literal.

Example:

'a'

unsigned numeric literal ::=

An unsigned numeric literal value.

Example:

1.234

ddl statement ::=

A data definition statement.

Example:

CREATE FOREIGN TABLE X (Y STRING)

option namespace ::=

A namespace used to shorten the full name of an option key.

Example:

SET NAMESPACE 'http://foo' AS foo

create procedure ::=

Defines a procedure or function invocation.

Example:

CREATE FOREIGN PROCEDURE proc (param STRING) RETURNS STRING

procedure parameter ::=

A procedure or function parameter

Example:

OUT x INTEGER

procedure result column ::=

A procedure result column.

Example:

x INTEGER

create table ::=

Defines a table or view.

Example:

CREATE VIEW vw AS SELECT 1

foreign key ::=

Defines the foreign key referential constraint.

Example:

FOREIGN KEY (a, b) REFERENCES tbl (x, y)

primary key ::=

Defines the primary key.

Example:

PRIMARY KEY (a, b)

other constraints ::=

Defines ACCESSPATTERN and UNIQUE constraints and INDEXes.

Example:

UNIQUE (a)

column name list ::=

A list of column names.

Example:

(a, b)

table element ::=

Defines a table column.

Example:

x INTEGER NOT NULL

options clause ::=

A list of statement options.

Example:

OPTIONS ('x' 'y', 'a' 'b')

option pair ::=

An option key/value pair.

Example:

'key' 'value'
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 12:09:27 UTC, last content change 2012-08-14 17:30:13 UTC.